Skip to content

Commit

Permalink
Merge pull request #506 from reflex-frp/ghc865-nixpkgs1903
Browse files Browse the repository at this point in the history
Update to GHC 8.6.5 and nixpkgs 19.03
  • Loading branch information
ali-abrar authored Aug 23, 2019
2 parents 51e0233 + 02389f2 commit 184d488
Show file tree
Hide file tree
Showing 49 changed files with 1,015 additions and 5,201 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ This project's release branch is `master`. This log is written from the perspect
## Unreleased

* Document how to accept android sdk license agreement and pass acceptance through to android infrastructure.
* Update to GHC(JS) 8.6.5
* Update to the nixos-19.03 nixpkgs channel
* Update to gradle build tools 3.1.0, androidsdk 9, and default to android platform version 28

## v0.1.0.0 - 2019-04-03

Expand Down
5 changes: 2 additions & 3 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ Many different platform are provided for you. A partial list of
possible platforms include:

- ghc
- ghcHEAD
- ghc8_4
- ghc8_6
- ghcjs
- ghcjs8_4
- ghcjs8_6

In addition, instead of specifying the name of the platform, you can
specify a path to a Nix expression file representing a Haskell
Expand Down
10 changes: 0 additions & 10 deletions a/A.hs

This file was deleted.

9 changes: 0 additions & 9 deletions a/a.cabal

This file was deleted.

102 changes: 102 additions & 0 deletions android/build-gradle-app.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{ stdenv, androidenv, jdk, gnumake, gawk, file
, which, gradle, fetchurl, buildEnv, runCommand }:

args@{ name, src, platformVersions ? [ "8" ]
, useGoogleAPIs ? false, useGooglePlayServices ? false
, release ? false, keyStore ? null, keyAlias ? null
, keyStorePassword ? null, keyAliasPassword ? null
, useNDK ? false, buildInputs ? [], mavenDeps, gradleTask
, buildDirectory ? "./.", acceptAndroidSdkLicenses ? false }:

assert release -> keyStore != null;
assert release -> keyAlias != null;
assert release -> keyStorePassword != null;
assert release -> keyAliasPassword != null;
assert acceptAndroidSdkLicenses;

let
inherit (stdenv.lib) optionalString optional;

m2install = { repo, version, artifactId, groupId
, jarSha256, pomSha256, aarSha256, suffix ? "" }:
let m2Name = "${artifactId}-${version}";
m2Path = "${builtins.replaceStrings ["."] ["/"] groupId}/${artifactId}/${version}";
in runCommand m2Name {} (''
mkdir -p $out/m2/${m2Path}
'' + optionalString (jarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.jar";
sha256 = jarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.jar
'' + optionalString (pomSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.pom";
sha256 = pomSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.pom
'' + optionalString (aarSha256 != null) ''
install -D ${fetchurl {
url = "${repo}${m2Path}/${m2Name}${suffix}.aar";
sha256 = aarSha256;
}} $out/m2/${m2Path}/${m2Name}${suffix}.aar
'');
androidsdkComposition = androidenv.composeAndroidPackages {
inherit platformVersions useGoogleAPIs;
includeExtras = [ "extras;android;m2repository" ]
++ optional useGooglePlayServices "extras;google;google_play_services";
};
in
stdenv.mkDerivation ({
inherit src;
name = builtins.replaceStrings [" "] [""] args.name;

ANDROID_HOME = "${androidsdkComposition.androidsdk}/libexec";
ANDROID_NDK_HOME = "${androidsdkComposition.ndk-bundle}/libexec/android-sdk/ndk-bundle";

buildInputs = [ jdk gradle ] ++ buildInputs ++ stdenv.lib.optional useNDK [ androidsdkComposition.ndk-bundle gnumake gawk file which ];

DEPENDENCIES = buildEnv { name = "${name}-maven-deps";
paths = map m2install mavenDeps;
};

buildPhase = ''
${optionalString release ''
# Provide key signing attributes
( echo "RELEASE_STORE_FILE=${keyStore}"
echo "RELEASE_KEY_ALIAS=${keyAlias}"
echo "RELEASE_STORE_PASSWORD=${keyStorePassword}"
echo "RELEASE_KEY_PASSWORD=${keyAliasPassword}"
) >> gradle.properties
''}
buildDir=`pwd`
cp -r $ANDROID_HOME $buildDir/local_sdk
chmod -R 755 local_sdk
export ANDROID_HOME=$buildDir/local_sdk/android-sdk
# Key files cannot be stored in the user's home directory. This
# overrides it.
export ANDROID_SDK_HOME=`pwd`
mkdir -p "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55" > "$ANDROID_HOME/licenses/android-sdk-license"
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
export APP_HOME=`pwd`
mkdir -p .m2/repository
if [ -d "$DEPENDENCIES/m2" ] ; then
cp -RL "$DEPENDENCIES"/m2/* .m2/repository/
fi
chmod -R 755 .m2
mkdir -p .m2/repository/com/android/support
cp -RL local_sdk/android-sdk/extras/android/m2repository/com/android/support/* .m2/repository/com/android/support/
gradle ${gradleTask} --offline --no-daemon -g ./tmp -Dmaven.repo.local=`pwd`/.m2/repository
'';

installPhase = ''
mkdir -p $out
cp -RL build/outputs/apk/*/*.apk $out
'';

meta = {
license = stdenv.lib.licenses.unfree;
};
} // builtins.removeAttrs args ["name" "mavenDeps"])
8 changes: 4 additions & 4 deletions android/build.gradle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.android.tools.build:gradle:3.1.0'
${googleServicesClasspath}
}
}
Expand All @@ -25,8 +25,8 @@ allprojects {
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.0'
compileSdkVersion 28
buildToolsVersion '28.0.3'
sourceSets {
main {
Expand All @@ -40,7 +40,7 @@ android {
defaultConfig {
applicationId "${applicationId}"
minSdkVersion 21
targetSdkVersion 26
targetSdkVersion 28
versionCode ${version.code}
versionName "${version.name}"
}
Expand Down
Loading

0 comments on commit 184d488

Please sign in to comment.