Why dub doesn't see the source folder? - directory

I wanted to run my first project with dub. I initialized the project with dub init sandbox', then ran it with dub run. But dub said this:
Configuration 'application' of package sandbox contains no source files. Please add {"targetType": "none"} to its package description to avoid building it. Package with target type "none" must have dependencies to build.
I don't understand, why does it happen because I have source folder in my project. Here's a project tree:
sandbox
source
app.d
dub.json
And dub.json file:
{
"authors": [
"MAX_PC"
],
"copyright": "Copyright © 2021, MAX_PC",
"description": "A minimal D application.",
"license": "proprietary",
"name": "sandbox"
}
EDIT:
This is a whole output
D:\DEVELOPMENT\[ D ]>dub init sandbox
Package recipe format (sdl/json) [json]:
Name [sandbox]:
Description [A minimal D application.]:
Author name [MAX_PC]:
License [proprietary]:
Copyright string [Copyright ┬й 2021, MAX_PC]:
Add dependency (leave empty to skip) []:
Successfully created an empty project in 'D:\DEVELOPMENT\[ D ]\sandbox'.
Package successfully created in sandbox
D:\DEVELOPMENT\[ D ]>cd sandbox
D:\DEVELOPMENT\[ D ]\sandbox>dub run
Configuration 'application' of package sandbox contains no source files. Please add {"targetType": "none"} to its package description to avoid building it.
Package with target type "none" must have dependencies to build.

The problem is solved! Spaces in the path to the project were the reason! So, don't write paths like me: D:\DEVELOPMENT\[ D ]

Dub created a new project sub-folder with name sandbox. Assuming your original project folder was myproject, then you need to use dub run at myproject/sandbox. You can move the contents to the project root folder or run dub init at your desire project location, no second argument.

Related

Exporting public C headers with SwiftPM

I have an open source Objective C framework, which I'd like to provide using Swift Package Manager as well.
Normally, I have public headers set in the Xcode project, which, when the framework is built, are copied under the framework bundle, and are discovered when linked to by Xcode.
I can't, however get it to work with SwiftPM.
I created a modulemap for my framework:
framework module LNPopupController {
umbrella header "LNPopupController.h"
export *
module * { export * }
}
and I define the library like so in the Package.swift:
let package = Package(
name: "LNPopupController",
platforms: [
.iOS(.v12),
.macOS(.v10_15)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "LNPopupController",
type: .dynamic,
targets: ["LNPopupController"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "LNPopupController",
dependencies: [],
path: "LNPopupController",
publicHeadersPath: ".",
cSettings: [
.headerSearchPath("."),
.headerSearchPath("Private"),
]),
]
)
When added as a project dependency in Xcode, the framework compiles just fine, but when the dependent target attempts to import LNPopupController, an error is thrown: umbrella header 'LNPopupController.h' not found
Looking at the build folder, indeed, I see that Xcode has built a binary, but has not copied the public headers.
Any way to specify which headers are public, and make the build system copy them for import?
I eventually figured it out. This is what I did for LNPopupController:
I created a include/LNPopupController/ sub-directory tree, and put soft links to all public headers there.
In the package file, I added publicHeadersPath: "include".
You can see the final result here:
https://github.com/LeoNatan/LNPopupController/blob/master/Package.swift
It might not be the most optimal way, but it works for all my ObjC projects which I have tried this method on.

Why VS2019 marks my extension as deprecated

I don't use VSIX for integration (supports old VS and SSMS). Installer puts all dlls to "program files" and pkgdef and manifest to specific folders. Currently VS2019 shows message that my extension use "deprecated API".
Image with message from learn.microsoft.com but it's the same.
I done this steps:
I created asyncPackage (now empty).
Added with
Microsoft.VisualStudio.Component.CoreEditor to vsixmanifest
Generated catalog.json and manifest.json using code from here
My package looks so (constructor is empty now)
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "7.1.7", IconResourceID = 115)]
[ProvideMenuResource("MyMenus.ctmenu", 1)]
[ProvideAutoLoad(GuidList.ShellInitialized, PackageAutoLoadFlags.BackgroundLoad)]
[ProvideAutoLoad(VSConstants.UICONTEXT.NoSolution_string, PackageAutoLoadFlags.BackgroundLoad)]
[System.Runtime.InteropServices.Guid(GuidList.guidMyPkgString)]
public sealed class MyPackage : AsyncPackage {
But VisualStudio shows message about deprecated API again and again. What I missed? What VS checks during package loading?
Edit: I created AsyncPackage, added attributes, updated integration files to VsixV3. Why VS loads extension synchronously?
For whom this can help to resolve the same issue.
As I mentioned above we don't use VSIX. And all files are coping by installer. The issue was that this was missed:
[$RootKey$\Packages\{YOUR PACKAGE GUID}]
#="YOUR PACKAGE NAME"
"AllowsBackgroundLoad"=dword:00000001
I've found it during checking all packages in private registry privateregistry.bin
Also don't forget about UI Context if you are using it:
[$RootKey$\AutoLoadPackages\$UICONTEXT_GUID}]
"$YOUR_PACKAGE_GUID”= dword:00000002
Thanks to MS git

Unity/Firebase - Project Bundle ID does not match any bundle IDs in your google-services.json files

I'm making a mobile game on Unity, Android first.
And now I'm integrating firebase analytics.
After set info on Firebase Console and put google-services.json file into Unity project, Unity shows an error saying :
Project Bundle ID com.RetroSpirit.ToiletRush does not match any bundle IDs in your google-services.json files
This will result in an app that will fail to initialize.
Available Bundle IDs:
You need to either:
* Fix your app's bundle ID under "Player Settings --> Bundle Identifier"
or:
* Add another app to your firebase project
Goto https://firebase.google.com/docs/unity/setup#add_firebase_to_your_app_1
and add the new configuration file to your project.
UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:LogErrorIfEnabled(String)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(SortedDictionary`2, String, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:FindGoogleServicesFile(String, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateJson(Boolean, LogMessage, LogMessage)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:OnPostprocessAllAssets(String[], String[], String[], String[])
UnityEditor.AssetPostprocessingInternal:PostprocessAllAssets(String[], String[], String[], String[], String[])
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Here's the part of google-services.json,
"client": [
{
"client_info": {
"mobilesdk_app_id": "*:***********:android:****************",
"android_client_info": {
"package_name": "com.RetroSpirit.ToiletRush"
}
},
"oauth_client": [
{
"client_id": "***********-********************************.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.RetroSpirit.ToiletRush",
"certificate_hash": "****************************************"
}
I don't know what should I check.
Project Bundle ID (the Package name on Build Settings - Other Settings - Identification) is exactly same as package_names in google-services.json.
Any ideas?
My case was in Unity and to fix it I added the google-services.json from the firebase project to the assets folder. I had only the GoogleService-Info.plist before.
Little bit funny to answer myself...
I found the reason of problem accidently. There was something wrong with my VC runtime so generate_xml_from_google_services_json.exe couldn't extract package name from google-services.json. (vc90.crt.manifest could not be extracted!)
Unfortunately, I couldn't fix that runtime error despite so many re-install of Visual Studio, VC Runtime and .net frameworks. Finally I re-installed Windows 10 and the problem just gone away... Still don't know what caused this error.
I understand you have fixed this by re-installing Windows but this is how I got passed this problem in case anyone else runs into this:
Make sure you have set your Package Name in Unity player settings (Edit > Project Settings > Player > Other Settings > Identification > Package Name).
Set to the same one you set up in Firebase (looks like com.CompanyName.ProductName).
Make sure you have imported the Firebase assets into your Unity project as described here https://firebase.google.com/docs/unity/setup and that the Firebase folder exists in Assets > Firebase. Changing the location of this folder seems to break things.
In our case we solved the issue by requesting a new google-services.json file from a collegue who has admin rights.
In my case, the issue was with the Package Name. So I followed the following steps and solved the problem:
Change the package name (com.companyname.appname) [everything in lowercase]
Delete the existing keystore
Add a new keystore and generating a fingerprint with Keytool
Delete the current app from the Firebase console
Add a new app with the correct package name and the generated fingerprint
download google-services.json again and Import to Unity under the Assets folder
Done! It works!!
hey everyone I found a fix to this issue I'm using mac pro m1
step to fix
reinstall visual studio
download Microsoft.NET.Sdk.Android from the visual studio website
restart the project
and after that, it will fix

Meteor 0.9 package publish issue

As per this https://hackpad.com/Migrating-Packages-zN0we9sIjkH I created a new meteor package and currently facing a problem when trying to publish.
PackageName : 'UserId:packageName'
To add package : 'meteor add packageName' (mateor add UserId:packageName did not work).
Package runs locally without any issue.
When I tried to publish,
cd path/to/your:package
meteor publish
Message :
There is no package named 'packageName'. If you are creating a new package, use the --create flag.
Publish failed.
Then I tried "meteor publish --create"
Message :
To confirm that you wish to create a top-level package with no account
prefix, please run this command again with the --top-level option.
(Only administrators can create top-level packages without an account prefix)
I used "UserId: PackageName" when creating the package and already log in to meteor account. Any idea to fix this issue?
Thanks !
Make sure the name field is in package.js:
Package.describe({
name: "user:packagename",
// other fields
});
Then, there will be no need to make sure the package is in a directory with the same name.
See https://github.com/mizzao/meteor-user-status for an example.

Defining plugin dependency between subprojects in SBT?

EDIT:
Since I put up the bounty, I thought I should restate the question
How can a SBT project P, with two sub-projects A and B, set up B to have a plugin dependency on A, which is a SBT plugin?
Giving P a plugin dependency on A does not work, since A depends on other things in P, which results in a circular dependency graph
It has to be a plugin dependency, for A is a plugin needed to run Bs test suite.
dependsOn doesn't work, because, well, it has to be a plugin dependency
I'd like to know either of
How to do this, or
Why this is impossible, and what the next best alternatives are.
EDIT: clarified that it's a plugin-dependency, since build-dependency is ambiguous
When you have a multi-project build configuration with "project P and two sub-projects A and B" it boils down to the following configuration:
build.sbt
lazy val A, B = project
As per design, "If a project is not defined for the root directory in the build, sbt creates a default one that aggregates all other projects in the build." It means that you will have an implicit root project, say P (but the name is arbitrary):
[plugin-project-and-another]> projects
[info] In file:/Users/jacek/sandbox/so/plugin-project-and-another/
[info] A
[info] B
[info] * plugin-project-and-another
That gives us the expected project structure. On to defining plugin dependency between B and A.
The only way to define a plugin in a SBT project is to use project directory that's the plugins project's build definition - "A plugin definition is a project in <main-project>/project/." It means that the only way to define a plugin dependency on the project A is to use the following:
project/plugins.sbt
addSbtPlugin("org.example" % "example-plugin" % "1.0")
lazy val plugins = project in file(".") dependsOn(file("../A"))
In this build configuration, the plugins project depends on another SBT project that happens to be our A that's in turn a plugin project.
A/build.sbt
// http://www.scala-sbt.org/release/docs/Extending/Plugins.html#example-plugin
sbtPlugin := true
name := "example-plugin"
organization := "org.example"
version := "1.0"
A/MyPlugin.scala
import sbt._
object MyPlugin extends Plugin
{
// configuration points, like the built in `version`, `libraryDependencies`, or `compile`
// by implementing Plugin, these are automatically imported in a user's `build.sbt`
val newTask = taskKey[Unit]("A new task.")
val newSetting = settingKey[String]("A new setting.")
// a group of settings ready to be added to a Project
// to automatically add them, do
val newSettings = Seq(
newSetting := "Hello from plugin",
newTask := println(newSetting.value)
)
// alternatively, by overriding `settings`, they could be automatically added to a Project
// override val settings = Seq(...)
}
The two files - build.sbt and MyPlugin.scala in the directory A - make up the plugin project.
The only missing piece is to define the plugin A's settings for the project B.
B/build.sbt
MyPlugin.newSettings
That's pretty much it what you can do in SBT. If you want to have multi-project build configuration and have a plugin dependency between (sub)projects, you don't have much choice other than what described above.
With that said, let's see if the plugin from the project A is accessible.
[plugin-project-and-another]> newTask
Hello from plugin
[success] Total time: 0 s, completed Feb 13, 2014 2:29:31 AM
[plugin-project-and-another]> B/newTask
Hello from plugin
[success] Total time: 0 s, completed Feb 13, 2014 2:29:36 AM
[plugin-project-and-another]> A/newTask
[error] No such setting/task
[error] A/newTask
[error] ^
As you may have noticed, newTask (that comes from the plugin from the project A) is available in the (default) root project and the project B, but not in A.
As Jacek said, it cannot be done as I would like, as a subproject cannot have a SBT plugin that the root project does not. On the other hand, this discussion on the mailing list contains several alternatives, and would no doubt be useful to anyone who comes across this question in the future.
EDIT: Well, in the end the alternatives mentioned (sbt scripted, etc) were hard and clunky to use. My final solution was to just have a separate project (not subproject) inside the repo that depends on the original project via it's ivy coordinates, and using bash to publishLocal the first project, going into the second project and running its tests
sbt publishLocal; cd test; sbt test; cd ..
I always thought the point of something like SBT was to avoid doing this kind of bash gymnastics, but desperate times call for desperate measures...
This answer may include the solution https://stackoverflow.com/a/12754868/3189923 .
From that link, in short, set exportJars := true and to obtain jar file paths for a (sub)project exportedProducts in Compile.
Leaving the facts about plugins by side, you have a parent project P with sub-projects A and B. And then you state that A depends on P. But P is a aggregate of A and B and hence depends on A. So you already have a circular dependency between A and P. This can never work.
You have to split P in two parts: The part where A depends on (let's call this part A') and the rest (let's call this P_rest). Then you throw away P and make a new project P_rest consisting of A', A and B. And A depends on A'.

Resources