move lib-R generation earlier