When I am importing antlr, as in below
import org.antlr.v4.runtime.*
...
I get the error message saying Unresolved reference: antlr.
Not quite sure if you need this info, but my build.gradle is currently as follows:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'org.jetbrains.intellij' version '1.2.1'
id 'java'
}
group 'me.ylee'
version '1.0-SNAPSHOT'
repositories {
google()
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.0"
implementation "org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.21"
implementation "net.java.dev.jna:jna:5.11.0"
// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
intellij {
plugins = ['Kotlin', 'java']
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
How can I successfully import the antlr? Do I need to include antlr somewhere in the build.gradle?
Any help would be appreciated!
I have figured it out. I realized I needed to add antlr-related dependencies as shown in the revised build.gradle as shown below:
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.6.10'
id 'org.jetbrains.intellij' version '1.2.1'
id 'java'
id 'antlr'
}
group 'me.ylee'
version '1.0-SNAPSHOT'
repositories {
google()
mavenLocal()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.6.0"
implementation 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.21'
implementation "net.java.dev.jna:jna:5.11.0"
antlr 'org.antlr:antlr4:4.10.1'
implementation 'org.antlr:antlr4-runtime:4.10.1'
// Dependency on local binaries
implementation fileTree(dir: 'libs', include: ['*.jar'])
}
intellij {
plugins = ['Kotlin', 'java']
}
compileKotlin {
kotlinOptions.jvmTarget = '1.8'
}
compileTestKotlin {
kotlinOptions.jvmTarget = '1.8'
}
Related
I have a project that requires an additional "config" file that I would like compiled into the final webpack bundle as an additional export of the bundled library.
The condition is that this config file, shouldn't need to be added to the entry file, but simply added an an additional export to the bundle.
I'm still relatively new to Webpack, but have been looking into how I might be able to accomplish this for a while now with no avail. Any help on getting into the right direction would be greatly appreciated!
Entry File (ts, using ts-loader):
export default class TestPlugin {
this.name: string;
constructor(name: string) {
this.name = name;
}
}
Plugin "config".
{
"name": "test plugin"
}
Plugin "loader" logic (separate project).
const plugin = require(path.resolve(pluginDirectory, fileName)
const config = plugin.config
const newPlugin = new plugin(config.name)
Webpack Config.
entry: ['./src/index.ts'],
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
},
],
},
output: {
filename: 'example.plugin.js',
path: path.resolve(__dirname, 'build'),
library: 'plugin',
libraryTarget: 'umd',
libraryExport: 'default',
globalObject: 'this',
},
How to connect Kotlin Coroutines in LibGDX?
At the moment, the latest version of Kotlin coroutines: 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
build.gradle (App):
Desctop:
project(":desktop") {
apply plugin: "java-library"
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-lwjgl:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
// Kotlin Coroutines / Flow
def kotlinCoroutinesFlow = "1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-
core:$kotlinCoroutinesFlow"
}
}
Core:
project(":core") {
apply plugin: "java-library"
dependencies {
api "com.badlogicgames.gdx:gdx:$gdxVersion"
// Kotlin Coroutines / Flow
def kotlinCoroutinesFlow = "1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesFlow"
}
}
Android:
project(":android") {
apply plugin: "com.android.application"
configurations { natives }
dependencies {
implementation project(":core")
api "com.badlogicgames.gdx:gdx-backend-android:$gdxVersion"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-armeabi-v7a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-arm64-v8a"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86"
natives "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-x86_64"
// Kotlin Coroutines / Flow
def kotlinCoroutinesFlow = "1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesFlow"
}
}
iOS:
project(":ios") {
apply plugin: "java-library"
apply plugin: "robovm"
dependencies {
implementation project(":core")
api "com.mobidevelop.robovm:robovm-rt:$roboVMVersion"
api "com.mobidevelop.robovm:robovm-cocoatouch:$roboVMVersion"
api "com.badlogicgames.gdx:gdx-backend-robovm:$gdxVersion"
api "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-ios"
// Kotlin Coroutines / Flow
def kotlinCoroutinesFlow = "1.5.2"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinCoroutinesFlow"
}
}
I am trying to build a Kotlin multiplatform project to serve as a shared module for iOS and Android app. I am trying to integrate SQLDelight but I am stuck with this error while syncing Gradle. The following are the error and the build.gradle file respectively.
Error
Could not resolve com.squareup.sqldelight:native-driver:1.3.0.
Required by:
project :
Possible solution:
- Declare repository providing the artifact, see the documentation at
https://docs.gradle.org/current/userguide/declaring_repositories.html
build.gradle
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
}
repositories {
mavenCentral()
jcenter()
google()
}
group 'com.example'
version '0.0.1'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'maven-publish'
def ktor_version = '1.3.2'
kotlin {
jvm()
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
iosX64("ios") {
binaries {
framework()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
dependencies {
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
}
}
iosTest {
}
}
}
configurations {
compileClasspath
}
I removed the
implementation "com.squareup.sqldelight:native-driver:1.3.0" from commonMain's dependecies.
It worked.
Working build.gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
google()
}
dependencies {
classpath 'com.squareup.sqldelight:gradle-plugin:1.3.0'
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.72'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.72'
}
repositories {
mavenCentral()
jcenter()
google()
}
group 'com.example'
version '0.0.1'
apply plugin: 'com.squareup.sqldelight'
apply plugin: 'maven-publish'
def ktor_version = '1.3.2'
kotlin {
jvm()
// This is for iPhone simulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
iosX64("ios") {
binaries {
framework()
}
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jvmMain {
dependencies {
implementation kotlin('stdlib')
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
implementation "com.squareup.sqldelight:sqlite-driver:1.3.0"
}
}
jvmTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
dependencies {
implementation "io.ktor:ktor-client-ios:$ktor_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
implementation "com.squareup.sqldelight:native-driver:1.3.0"
}
}
iosTest {
}
}
}
configurations {
compileClasspath
}
I am using android studio 3.0, and i downloaded a project from http://www.androidbootstrap.com and when i import that project it gives me error as "Gradle sync failed: CreateProcess error=2, The system cannot find the file specified".
This type of question and respective answers already posted but non of them solve my problem due to this reason i am posting this question please understand this.
the Gradle Script>build.gradle is:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
repositories {
jcenter()
}
}
and app\build.gradle is:
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'io.fabric.tools:gradle:1.19.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.neenbedankt.android-apt'
repositories {
maven { url 'https://github.com/donnfelker/mvn-repo/raw/master/' }
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
def computeVersionCode() {
if (System.env.BUILD_NUMBER) { // Check if there is a system build number.
return "$System.env.BUILD_NUMBER".toInteger()
} else if (System.env.CIRCLE_BUILD_NUM) { // Check to see if this is built on circle CI
return "$System.env.CIRCLE_BUILD_NUM".toInteger()
} else {
return 1 // if none is found, default to 1.
}
}
def computeVersionName() {
return "1." + computeVersionCode()
}
//noinspection GroovyUnusedAssignment
def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 18
targetSdkVersion 23
versionCode computeVersionCode()
versionName computeVersionName()
// Enable this if you want to use Build.GIT_SHA in your code somewhere.
// This will give you the last GIT_SHA that was committed
// buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
packagingOptions {
// Exclude file to avoid
// Error: Duplicate files during packaging of APK
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'LICENSE.txt'
}
signingConfigs {
// Uncomment and set values and then this will work
// release {
// storeFile file(System.getenv('ANDROID_KEYSTORE_PATH'))
// storePassword System.getenv('ANDROID_STORE_PASS')
// keyAlias System.getenv('ANDROID_KEY_ALIAS')
// keyPassword System.getenv('ANDROID_KEY_PASS')
// }
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
applicationIdSuffix '.debug'
minifyEnabled false
// zipAlign false // this is default for debug
}
release {
// minifyEnabled true
// proguardFile '..\proguard.cfg'
// signingConfig signingConfigs.release
// zipAlign true // this is default for release
// testPackageName 'example.com.tests'
// testInstrumentationRunner 'android.test.InstrumentationTestRunner' // this is the default
}
}
}
dependencies {
// Android Support Libs
compile 'com.android.support:support-v4:23.0.1'
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.code.gson:gson:2.3'
// Dependency Injection
compile 'com.google.dagger:dagger:2.0'
// View Injection
compile 'com.jakewharton:butterknife:7.0.1'
// Logging
compile 'com.jakewharton.timber:timber:3.0.2'
compile 'com.actionbarsherlock:viewpagerindicator:2.4.1'
compile 'com.nineoldandroids:library:2.4.0'
// Event Bus
compile 'com.squareup:otto:1.3.5'
// Image Loading
compile 'com.squareup.picasso:picasso:1.1.1'
// HTTP
compile 'com.squareup.retrofit:retrofit:1.5.1'
// Fabric/Crashlytics
compile('com.crashlytics.sdk.android:crashlytics:2.2.3#aar') {
transitive = true
}
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'com.android.support.test:runner:0.4'
// Set this dependency to use JUnit 4 rules
androidTestCompile 'com.android.support.test:rules:0.4'
// Set this dependency to build and run Espresso tests
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.1'
// Contrib
androidTestCompile('com.android.support.test.espresso:espresso-contrib:2.2.1') {
// http://stackoverflow.com/a/30931887/5210
exclude group: 'com.android.support', module: 'appcompat'
exclude group: 'com.android.support', module: 'support-v4'
exclude module: 'recyclerview-v7'
}
// Set this dependency to build and run UI Automator tests
androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2'
androidTestCompile 'org.mockito:mockito-core:1.9.5'
apt 'com.google.dagger:dagger-compiler:2.0'
provided 'javax.annotation:jsr250-api:1.0'
}
Try instead proxy settings of your project.
I'm trying to automatically bundle all jspm dependencies --so I don't have to maintain a manual list-- with a gulp task:
var gulp = require('gulp');
var bundler = require('aurelia-bundler');
var package = require('../../package.json');
var jspmDeps = Object.keys(package.jspm.dependencies);
var config = {
force: true,
baseURL: '.',
configPath: './system.config.js',
bundles: {
"output/jspm": {
"includes": jspmDeps,
"options": {
"minify": false,
"inject" : true
}
}
}
};
gulp.task('build-jspm', function () {
return bundler.bundle(config);
});
Unfortunately, this isn't picking up and bundling all sub-dependencies of the modules included in the bundle. Quite a few dependencies are dynamically loaded by aurelia, which don't get detected during bundling.
Is there a way to force aurelia-bundler (or jspm-cli) to bundle the entire dependency tree from jspm?
[Update] Turns out jspm's bundler has the same behavior, in that it won't bundle modules unless it detects a call to import 'some-sub-dependency'; there are plans to trace dynamic loading at some point