I'm looking to include a demo app with a Swift Package of custom controls that shows implementation demos for each of the controls. Is there a way that I can include this in the Swift Package (and also develop/test the controls directly inside the package this way)?
Here are the steps that worked for me on Xcode 13:
Create a package called MyLibrary
Create a new Project App MyLibraryDemo inside the package directory
Open the project's .xcodeproj file
Go to PROJECT > MyLibraryDemo > Package Dependencies and press the 'plus' symbol
Press Add Local and select the directory containing your pacakge
Go to the app's TARGET > General > Frameworks, Libraries and Embeded Content, and press 'add'
Select your package from the list
Now you can import your MyLibrary package into your example app, and edit / update your package from within you demo project.
Some Notes:
If your package / demo has other dependencies, and those other dependencies get updated, you may have to clear DerivedData before doing an update
You may also have to close & re-open Xcode, especially if you've updated dependencies, but it still says "Cannot find package MyLibrary"
What kind of app? SwiftPM only directly supports macOS/Linux executables.
If you want an iOS/tvOS/watchOS one you will need an Xcode project that links using a relative path to find your package. This is done by creating the example app and dragging the Package's containing directory into the Xcode project. You can then link the library. If you put this example app in the repo with the package then it will be distributed along with anyone who clones the package.
One important thing I have noticed (which is almost certainly a bug in Xcode) when doing this myself is that the Package.swift and Example.xcodeproj cannot be in the same directory. You have to nest the Xcode project into another directory or it will have issues building/linking a lot of the time. So if you run into any issues With what I have suggested also try this bandaid.
I have created an example on GitHub here that works for Xcode 11.3.
The best approach is to use "Xcode workspace".
How does it work?
1. Create your artifacts
Create a directory.
Create an Xcode workspace inside there (Xcode: File: New: Workspace). Then create your library (package), and create your app (whatever type) inside the same directory.
In this step, just place the package and the app in the above directory, and close them immediately.
It should look like this.
2. Link your artifacts
Open your .xcworkspace file.
In the left bottom corner, click "+" sign.
Select "Add files to your_workspace_name", then:
a) for the Demo app
Navigate to the app's directory, select Your_app.xcodeproj and hit Add.
b) for the package
Navigate to the package's directory, and select the package directory only. Before hitting Add button, make sure "Create folder references for any added folders" is selected.
Your entire workspace should look like this now. You can immediately import the library inside your app and you are ready to go.
Related
I have multiple targets in my project and I added a package dependency on the project that has a binaryTarget to a zip that contains my xcframework. It adds it to my project, my main target has it but when I try to add it to my other targets via General > Frameworks and Libraries it's not listed in the dialog for me to choose (nor is it in Link Binary with Libraries either.
Xcode 14.1
I can replicate this with other packages that just have binaryTarget as well like https://github.com/PSPDFKit/PSPDFKit-SP. Packages that just have source are fine.
I have tried deleting the package and then adding again after having added my new targets, tried shutting down xcode and restarting.
I had the same issue, and the solution for me was a small hack in the project.pbxproj file, as follows:
Navigate in the Finder to the project directory -> Right click on the .xcodeproj file -> Show Package Content. You will find the project.pbxproj file there.
Search for the productDependencies key. You will find as many as targets you have in your project with Embedded/Linked frameworks. If your second target does not have framework yet, just try to add a generic Swift package, so Xcode will make the necessary changes for you in the project.pbxproj
Copy the line with the given binary linked library to the required target section/list.
I hope this helps, for me it was finally working. However I think it is still some kind of bug in Xcode/SPM.
I finished writing a little tornadofx app in IntelliJ CE and now want to export it as a single file which can be downloaded and launched by users. For now it would be sufficient to provide a single jar file. But it would be also great to know on how to export a self contained installer for OSX, Windows and Linux. Unfortunately I don't know how to do any of that. Can you help?
Have a look at the FxLauncher project, which is also from the creator of tornadoFX. FXLauncher allows you to easily distribute your javafx/tornadoFX application. The project provides a maven-plugin which allows you to generate a self containing javafx/tornadoFX application that you then publish to a web-server or common directory (e.g an internal app in your company network). After that you can generate native installers for Linux, OSX and Windows. The installer itself will only install a small app, which will know the location of your web-serve or directory. On startup it will download the latest deployed version of you application and run it.
Additional links:
GitHub-project
Introduction screen cast
Customizing update ui
In case you want a single jar file, you can export it as a regular Java program (not the JavaFX option in IntelliJ). You do this by creating and building an artifact.
Go to the Project Structure window, and from there select Artifacts
Click the "+" icon to create a new artifact, and select JAR > From modules with dependencies...
Select the main class and press OK
And that's it, the artifact has been set up, now, to generate jar file, just go to Build > Build Artifacts menu, and select the newly-made artifact, and the IntelliJ will generate the jar file in the "out" directory.
Not sure if this is the best solution, but it's what I've been using, and it works for me.
I am trying to use meteor typeahead package in my project. It has some issues with it, so the developer asked me to create a local PR and use it. The thing is that I don't know how to create a local PR. Do I need to create a local package and then add it to my project, etc. I cloned the repository to my local machine, and changed the code that I need, but I don't know what to do after this. Can somebody help me with this please.
Thanks
After you cloned the package just copy all the files in a packages/name_of_the_package folder of your Meteor project.
You can also create a symbolic link between the package folder and the package folder in the Meteor project. So all changes are automatically reflected.
Then, add it as usual with meteor add name_of_the_package or by modifying the .meteor/packages file. Meteor will look in priority in the local package folder instead of the official repository.
Create a fork of the desired repo.
Clone your fork of the repo as a sub folder of the "packages" folder within your app.
Remove the atmosphere package by performing a meteor remove some:package
Add the package back, just as you normally would, with meteor add some:package. Meteor will find the local copy and use it, instead of downloading the package from Atmosphere.
Make the desired code changes, testing it before you commit.
Commit your changes to Github.
Create a pull request within the fork on Github.
In addition to controlling solution packages folder and away from it, do I have the right to move files of a VS2013 solution package like jQuery and jQuery UI to a different folder than solution1/Scripts and get them updated later? can I chose a custom location while install or at any stage?
Yes. Nugent just makes installing a little easier.. You'll just need to change your links to your scripts folder to wherever you saved them to.
How to install packages in a different location from the default "Packages" folder?
This can be done by setting the "repositoryPath" settings in nuget.config.
More Details and step by step Here
I would like to add the extern jar library commons-jexl-2.1.1.jar. I copied the jar into the libs/ folder and performed the Add as library... menu point. I don't receive any errors in the code and everything seems to work but when compiling and starting the application I receive the error java.lang.NoClassDefFoundError: org.apache.commons.jexl2.JexlEngineon this line private JexlEngine jexl = new JexlEngine();
Does anyone know what I've missed?
Unfortunately, that menu command is doing the wrong thing for Gradle-based projects, which I assume yours is. (Gradle-based projects are what you get when you create new projects in Android Studio). I've filed bug https://code.google.com/p/android/issues/detail?id=62249 to request implementing this menu command properly for these projects, or at a minimum disabling it until it's implemented to prevent confusion.
In the meantime, you can add external JAR dependencies by going through the Project Structure dialog, which will add the appropriate entries to your build.gradle build file. Choose File menu > Project Structure, and click on the "Modules" entry on the left. Choose your module from the middle list, and click on the Dependencies tab on the right. Then click on the + button at the bottom to add a new dependency. Screen shot here:
The + menu has an option for "File dependency" (pictured). You will get a file chooser that will let you select the jar file.
If your dependency is one that can be found in Maven, you may find it more convenient to specify the Maven coordinates; that way, the build system will automatically download the dependency, and you won't have to download and store the JAR manually. To set that up, choose "Maven dependency" from the + menu. You'll get a dialog where you can search to find the proper Maven coordinates for your library. In your case, those coordinates will be "org.apache.commons:commons-jexl:2.1.1#jar"
If you prefer to edit build files by hand, check out your build.gradle file after completing the Project Structure dialog changes to see what it did.
The docs for using Gradle in Android are at http://tools.android.com/tech-docs/new-build-system
courtesy The App Chaps
I've been struggling with the same thing for many hours, trying to get the Gson jar to work no less. I finally cracked it – here are the steps I took:
Put the Gson jar (in my case, gson-2.2.4.jar) into the libs folder
Right click it and hit 'Add as library'
Ensure that compile files('libs/gson-2.2.4.jar') is in your build.gradle file
Do a clean build (you can probably do this fine in Android Studio, but to make sure I navigated in a terminal to the root folder of my app and typed gradlew clean. I'm on Mac OS X, the command might be different on your system
After I did the above three, it started working fine. I think the 'Add as library' step was the one I'd previously missed, and it didn't work until I cleaned it either.
[Edit - added the build.gradle step which is also necessary as others have pointed out]